<div class="sixteen columns">
    <div class="box_head">
        <h3><?php echo $title; ?></h3>
    </div>
    <?php
    $cart = new CI_Cart();
    $lib_rupiah = new Format_rupiah();
    $lib_img = new images_thumb();
    if ($cart->total_items() >= 1) {
        ?>
        <table class="cart_table">
            <thead>
                <tr>
                    <th class="first_td"><h4>Item Produk</h4></th>
            <th><h4>Harga</h4></th>
            <th><h4>Banyak</h4></th>
            <th><h4>Diskon (%)</h4></th>
            <th><h4>Sub Total</h4></th>
            <th><h4>Delete</h4></th>
            </tr>
            </thead>
            <tbody>
                <?php
                $grand = 0;
                foreach ($list_keranjang as $dta) {
                    $harga = $dta['price'];
                    $bnyk = $dta['qty'];
                    $diskon = $dta['options']['disc'];
                    $sub = ($harga * $bnyk) - ($harga * $bnyk) * $diskon / 100;

                    $grand = $sub + $grand;
                    $gambar = base_url() . "uploads/" . $dta['options']['id_produk'] . "/" . $lib_img->image($dta['options']['image']);
                    ?>
                    <tr>
                        <td class='first_td'>
                            <div class='clearfix'>
                                <img src='<?php echo $gambar; ?>' alt='product image' width="100">
                                <span>
                                    <strong><a href='#'><?php echo $dta['name']; ?></a></strong><br>
                                    Color: <?php echo $dta['options']['Color']; ?><br>
                                    Size: <?php echo $dta['options']['Size']; ?>
                                </span>
                            </div>
                        </td>
                        <td class='total_price'>
                            <h5><?php echo $lib_rupiah->rupiah($harga); ?></h5>
                        </td>
                        <td class='quantity'>
                            <form>
                                <label>
                                    <input type='text' readonly maxlength='12' name='' id='' class='' value='<?php echo $bnyk; ?>' size='2'>
                                </label>
                            </form>
                            <?php
                            echo anchor("main/produk/produk_det/" . $dta['options']['id_produk'], "<span>Edit Quantity</span>");
                            ?>
                        </td>
                        <td>
                            <h5><?php echo $diskon ?>%</h5>
                        </td>
                        <td class='total_price'>
                            <h5><?php echo $lib_rupiah->rupiah($sub); ?></h5>
                        </td>

                        <td>
                            <?php
                             echo anchor("main/keranjang/delete_item/" . $dta['rowid'], "delete","class='delete_items'");
                            ?>
                        </td>
                    </tr>
                    <?php
                }
                ?>
            </tbody>
        </table>

    </div>

    <div class="six columns ">
        <table class="receipt">
            <tbody>
                <tr>
                    <td style="font-weight:600;font-size:16px;">GRAND TOTAL</td>
                    <td style="font-weight:600;font-size:16px;"><?php echo $lib_rupiah->rupiah($grand); ?></td>
                </tr>

            </tbody>
            <tfoot>
                <?php
                $masuk = $this->session->userdata('masuk');
                ?>
                <tr>
                    <td class="last_td">
                        <?php
                        echo anchor("main/produk/", "Kembali Pembelian", "class='gray_btn'");
                        ?>

                    </td>
                    <td class="last_td">
                        <?php
                        if ($masuk)
                            echo anchor("main/pembayaran/", "Lanjutkan Pembayaran", "class='red_btn' ");
                        else
                            echo anchor("main/pembayaran/", "Klik Login Untuk Melanjutkan Transaksi", "class='red_btn'");
                        ?>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="font-weight:600;font-size:12px;">BIAYA PENGIRIMAN AKAN DIHITUNG PADA LANGKAH BERIKUTNYA, SEBELUM ANDA MEMBAYAR</td>
                </tr>
            </tfoot>


        </table>
        <?php
    } else {
        echo "<br/><br/><br/><p style='text-align:center'><b>Keranjang Kosong !!!</b></p><br/>";
        echo "<p style='text-align:center'>Silahkan pilih dahulu berbagai produk yang kami tawarkan :) </p><br/><br/><br/><br/><br/><br/>";
    }
    ?>

</div>